home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 22 / CU Amiga Magazine's Super CD-ROM 22 (1998)(EMAP Images)(GB)[!][issue 1998-05].iso / PowerPC / Programming / PPCSmallEiffel / lib_se / creation_call_1.e < prev    next >
Encoding:
Text File  |  1998-01-16  |  2.4 KB  |  103 lines

  1. --          This file is part of SmallEiffel The GNU Eiffel Compiler.
  2. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  3. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr 
  4. --                       http://www.loria.fr/SmallEiffel
  5. -- SmallEiffel is  free  software;  you can  redistribute it and/or modify it 
  6. -- under the terms of the GNU General Public License as published by the Free
  7. -- Software  Foundation;  either  version  2, or (at your option)  any  later 
  8. -- version. SmallEiffel is distributed in the hope that it will be useful,but
  9. -- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. -- or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU General Public License 
  11. -- for  more  details.  You  should  have  received a copy of the GNU General 
  12. -- Public  License  along  with  SmallEiffel;  see the file COPYING.  If not,
  13. -- write to the  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. -- Boston, MA 02111-1307, USA.
  15. --
  16. class CREATION_CALL_1
  17.    -- 
  18.    -- For creation call like : 
  19.    --                           !!foo
  20.    --
  21.  
  22. inherit CREATION_CALL_1_2;
  23.       
  24. creation make
  25.    
  26. feature 
  27.    
  28.    type: TYPE is do end;
  29.    
  30.    make(sp: like start_position; w: like writable) is
  31.       require
  32.      sp /= Void;
  33.      w /= Void
  34.       do
  35.      start_position := sp;
  36.      writable := w;
  37.       end;
  38.    
  39.    compile_to_c is   
  40.       local
  41.      t: TYPE;
  42.       do
  43.      t := writable.result_type.run_type;
  44.      if t.is_reference then
  45.         c2c_opening(t);
  46.         c2c_closing(t);
  47.      else
  48.         c2c_clear_expanded(t.id);
  49.      end;
  50.       end;
  51.  
  52.    compile_to_jvm is
  53.       local
  54.      t: TYPE;
  55.       do
  56.      t := writable.result_type.run_type;
  57.      compile_to_jvm0(t);
  58.      t.jvm_check_class_invariant;
  59.      writable.jvm_assign;
  60.       end;
  61.    
  62.    use_current: BOOLEAN is   
  63.       do
  64.      Result := writable.use_current;
  65.       end;
  66.    
  67.    to_runnable(rc: like run_compound): like Current is
  68.       local
  69.      t: TYPE;
  70.       do
  71.      if run_compound = Void then
  72.         check_writable(rc);
  73.         t := writable.result_type;
  74.         check_created_type(t);
  75.         check_creation_clause(t);
  76.         Result := Current;
  77.      else
  78.         !!Result.make(start_position,writable);
  79.         Result := Result.to_runnable(rc);
  80.      end;
  81.       end;
  82.    
  83.    pretty_print is
  84.       do
  85.      fmt.put_string("!!");
  86.      writable.pretty_print;
  87.      if fmt.semi_colon_flag then
  88.         fmt.put_character(';');
  89.      end;
  90.       end;
  91.  
  92. invariant
  93.    
  94.    type = Void;
  95.    
  96.    call = Void;
  97.    
  98.    run_feature = Void;
  99.    
  100. end -- CREATION_CALL_1
  101.  
  102.  
  103.